-- defense_lost
-- created by panyl
-- 守卫失效

return {
    apply = function(prop, baseValue)
        return prop[3];
    end,

    -- 守卫触发
    trigger = function(who, prop, arg)
        local grid = arg;

        -- 不是怪物
        if not grid:isMonster() then
            return false;
        end

        -- 概率没发生
        if DungeonM.getRandSeed("defense_lost") % 1000 >= prop[3] then
            return false;
        end

        -- 怪物设置属性
        grid.monster.dbase:set("can_not_lock", 1);

        return true;
    end,

    record = function(target, prop, path)
        return false;
    end
};
